package classes.helper
{
	import mx.core.FlexGlobals;

	public class WebServiceIV
	{
		private static var URI_BASE:String ="http://172.21.1.123:61801/cl/innovision/sjm/";
		
		private static var URI_REPORTE:String = "http://localhost:8090/";
		
		public function WebServiceIV()
		{
		}
		
		public static function getServiceURL(wservice:String):String {
			var baseURL:String;
			baseURL = FlexGlobals.topLevelApplication.url;
			var pattern1:RegExp = new RegExp("http://[^/]*/[^/]*/*");
			if (pattern1.test(baseURL) == true) 
			{
				var pattern2:String = pattern1.exec(baseURL).toString();
				return pattern2.concat(wservice);
			} 
			else
			{
				return URI_BASE + wservice;
			}
		}
		
		public static function getReporteURL(wservice:String):String {
			var baseURL:String;
			baseURL = FlexGlobals.topLevelApplication.url;
			var pattern1:RegExp = new RegExp("http://[^/]*/[^/]*/*");
			if (pattern1.test(baseURL) == true) {
				return pattern1.exec(baseURL).toString().concat("../"+wservice);
			} else{
				return URI_REPORTE + wservice;
			}
		}
	}
}
